import { interval } from "rxjs";
import { bufferTime, bufferCount } from "rxjs/operators";
// bufferTime, bufferCount 案例

// 聊天提高性能，缓存三秒， 缓存三条数据，再渲染
const messageBox = document.getElementById("messageBox");
interval(1000)
  .pipe(bufferCount(3))
  .subscribe((messages) => {
    messageBox.innerHTML = messages.map(
      (message) => `<li>Message ${message}</li>`
    );
  });
